package com.jg.service.impl;

import com.jg.dao.AttendanceRecordDao;
import com.jg.dao.impl.AttendanceRecordDaoImpl;
import com.jg.entity.AttendanceRecord;
import com.jg.service.AttendanceService;
import org.apache.log4j.Logger;

import java.util.List;


/**
 * @author 86130
 * @version 1.0
 * @description: TODO
 * @date 2025/3/31 09:36
 */
public class AttendanceServiceImpl implements AttendanceService {
    private static Logger logger = Logger.getLogger(AttendanceServiceImpl.class.getName());

    AttendanceRecordDao attendanceRecordDao = new AttendanceRecordDaoImpl();
    @Override
    public void clockIn(String employeeId) {
        boolean flag = attendanceRecordDao.isClockIn(employeeId);
        if (flag){
            logger.debug("已打卡");
            attendanceRecordDao.updateClockIn(employeeId);
        }else{
            logger.debug("未打卡");
            attendanceRecordDao.clockIn(employeeId);
        }
    }

    @Override
    public List<AttendanceRecord> getAttendanceList(String employeeId, String startDate, String endDate) {
        logger.debug("获取打卡记录");
        return attendanceRecordDao.getAttendanceList(employeeId, startDate, endDate);
    }
}
